package com.zg.common.alter.autoconfigure;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * <p>Description: </p>
 *
 * @author zhanfeng.liang
 * @since 2025/2/11 16:43
 */

@ConfigurationProperties(prefix = "http.alert")
@Data
public class AlertProperties {
    private boolean enable = true;
    private int slowThreshold = 5000; // 慢请求阈值(ms)
    private int errorThreshold = 10;     // 错误次数阈值
    private List<Integer> errorCodes;
    private List<String> includePaths = Arrays.asList("/api/**");
    private List<String> excludePaths = new ArrayList<>();

    // 邮件配置
    private Email email = new Email();

    @Data
    public static class Email {
        private boolean enable = true;
        private String from;
        private String to;
        private String subject = "[系统预警] HTTP接口异常";
    }
}
